Note: This tutorial assumes that you have completed the previous tutorials: Toolchain Bridge.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Full Cross

Description: Cross-compiling in a cross-compiled ros.

Tutorial Level: INTERMEDIATE

Cross-Compiling in a Cross-Compiled Ros

Eros provides tools and patches to cross-compile, at the least, core ros packages as well as a few of the more commonly used packages.

Initial Steps

  • You will need an ros-ready toolchain pre-installed and ready for use.

  • Ensure you have a working installation.

  • Familiarise with and make sure the eros python tools are in your PATH.

By ros-ready, we mean that it already includes all the core dependencies for ros (aka log4cxx, boost etc). If your toolchain is just the bare minimum and needs these packages to be added, you can make use of eros' toolchain bridge to make it ros-ready.

Cross Configuration

The eros_toolchains and eros_platforms have a selection of preconfigured toolchains and platform configurations. Using rostoolchain, select a toolchain configuration - this will be installed into $ROS_ROOT/rostoolchain.cmake. Selecting, for example, the code sourcery arm:

rostoolchain list
rostoolchain select code_sourcery/arm-none-linux-gnueabi

Platforms which precache various compile time flags can also be chosen using rosplatform - these get modified to work as a drop-in for $ROS_ROOT/rosconfig.cmake. e.g.

rosplatform list
rosplatform select arm/Arm1176jzf-s

If a suitable toolchain/platform combination can't be found, you can create a user-defined module by running either of the above scripts with the create option.

Finally, make sure the correct build mode is set using rosbuild.

Crossing the Ros

When you selected the toolchain with rostoolchain, various patches were copied across to the ros tree to permit an easy cross-compile (these are slowly being pushed upstream).

From here it should be just a matter of making sure the ros packages aren't flagged ROS_NOBUILD from any previous compiles and then rebuild/protect a minimal set of packages for the cross compile.

rosprotect --unprotect --comms     OR     rosprotect --unprotect --minimal
rosprotect --pre-clean --comms            rosprotect --pre-clean --minimal

Building the --comms subset will build only packages necessary for doing ros comms with a remote master. Building the --minimal subset will build enough for a minimal, but working ros environment.

Note that additional ros packages won't compile unless you flesh out your toolchain with quite a few more dependencies (e.g. wxwidgets).

Additional Notes

When you cross compile the ros using the above method, roscpp and genmsg_cpp required a two pass build. The first pass cross compiles the package and the second pass natively builds the utilities needed by the ros build environment on your build computer.

rospack

Rospack installs a native rospack into $ROS_ROOT/bin and a cross-compiled rospack into rospack/bin. When preparing your embedded rootfs, be sure to copy across the cross-compiled rospack to its $ROS_ROOT/bin.

Wiki: eros/Tutorials/Full Cross (last edited 2011-04-13 08:42:29 by da-phil)